Director Article

Chrome Library Set of 3D Behaviors for Shockwave 3D

Karl Sigiscar

R3D

The Chrome Library set of 3D behaviors contains 60 Shockwave 3D behaviors that have been designed and developed to meet the needs of 3D graphic designers and developers who are beginners when it comes to Macromedia Director or RealTime 3D. It is also useful for developers who want to quickly set up their scenes. The Chrome Library was created for this purpose: making web 3D in Director easier and making the inner wonders of the 3D engine more readily available. The Chrome Library is free and available at the following address:

http://membres.lycos.fr/karlsigiscar/shockwave3d/

It would be impossible to go through all of the 3D behaviors in the Chrome Library. In this article, I will take you through an example of how to use a few of them. You can purchase the car W3D files used in this article from TurboSquid.com. However, you can use the Chrome Library behaviors on most any W3D file. Turbo Squid also has free W3D files that you can use to experiment with the Chrome Library behaviors. The mesh and textures in the W2D files in this article were created by Stephen Magnardi © 2003.

Requirements

To complete this tutorial you will need to install the following software and files:

Director MX


Tutorials and sample files:

Setting Up the 3D Scene of the Car

A designer creates a scene in a 3D package (such as 3DS Max or Lightwave), exports the scene to the Shockwave 3D format (one or several W3D files), and then imports the W3D file(s) into Director. In this article, I use two separate W3D files, one for the car body, and one for the wheels. The next step is to place the main W3D member on the stage (for instance, the W3D containing the car body and a booth).

The W3D Cast members

Figure 1. The W3D Cast members

This is when the Chrome Library comes into play. To start, you must first download, unzip, and copy the Chrome Library set of behaviors to the Director 3D Libs folder. On Windows, this is c:\program files\Macromedia\Director MX\Libs\3D. On Macintosh, this is Hard Drive | Applications | Macromedia Director MX | Libs | 3D.You can download the behaviors using the link at the beginning of this article. After having installed the Chrome Library, select Window > Chrome Lib > 3D. Your 3D library of behaviors will appear as shown in Figure 2.

The 3D library of behaviors

Figure 2. The 3D library of behaviors

(+) View larger

There are now 64 behaviors in the Chrome Lib. Christophe Leske, a former member of the Director Team at Macromedia, publishes the Chrome Lib on his website, director3d.de.

Setting Up 32-Bit Render Format for the Light Beams Alpha Channel

The W3D car

Figure 3. The W3D car

The car has four beam of light objects attached to it. For the time being, the texture render format is set to 16-bit (the Shockwave 3D default setting). But I have an alpha channel that I want to use so that the beams render at their best.

The Text Render Format behavior

Figure 4. The Texture Render Format behavior

  1. Drag and drop the Texture Render Format behavior onto the 3D scene. The parameter window in Figure 5 appears:

    The Parameters dialog box for the Text Render Format behavior

    Figure 5. The Parameters dialog box for the Text Render Format behavior

  2. Select RGBA8888 for the Texture Render Format parameter, in other words, 32-bit rendering.
  3. Press Play in the Director toolbar or press Enter/Return. The movie starts, and the beam of light objects now appear with a smooth gradient. The 32-bit texture render mode uses the embedded alpha channel that was set up in 3DS Max by the graphic artist.

    The beam of light objects with a smooth gradient from the Texture Render Format behavior

    Figure 6. The beam of light objects with a smooth gradient from the Texture Render Format behavior

Making the Beam of Light Objects Disappear

You only want to see the beam of light objects when the headlights are on. To do this, use the Model Visibility behavior.

The Model Visibility behavior

Figure 7. The Model Visibility behavior

Drag and drop the Model Visibility behavior onto the 3D scene. The parameter window in Figure 8 appears.

The parameters dialog box for the Model Visibility behavior

Figure 8. The parameters dialog box for the Model Visibility behavior

  1. Select none for the Drawing mode, which means none of the faces of the selected model is to be drawn (in other words, invisible).
  2. Select one of the beam of light object that you want to disappear (in this tutorial, select Left Headlight Ray of light).
  3. Press OK.
  4. Press Play in the Director toolbar or press Enter on the keypad. The movie starts. The left beam of light object disappears.

    The left beam of light object with the Model Visibility behavior applied to it

    Figure 9. The left beam of light object with the Model Visibility behavior applied to it

  5. Repeat steps one to four for the remaining three headlight beams.

Notice that the behaviors used are automatically copied in the internal cast.

The behaviors are copied to the internal cast

Figure 10. The behaviors are copied to the internal cast

You can drag and drop a given behavior from the library as many times as you want using a different set of parameters each time. Only one copy of this behavior will appear in the internal cast. However, a new entry will be added each time in the Behavior tab of the Property inspector with the corresponding parameters. In my case, I have four instances of the Model Visibility behavior:

Figure 10a. Four instances of the Model Visibility behavior in the Behavior pane of the property inspector.

Now the car appears exactly as I want it, without any beams of light:

The beam of light objects non-visible from having the Model Visibility behavior applied to them

Figure 11. The beam of light objects non-visible from having the Model Visibility behavior applied to them

Merging the Car Body and the Wheels

In my example, I have two separate W3D files. The main one contains the body of a car. The second one contains a set of four wheels (4 instances of the same wheel). You will merge the two W3D files so that the wheels load into the main scene and display under the car body. Their relative position has already been set in 3DS Max. You have two separate W3D files so that you can change the wheels of the car at runtime. You can create other W3D files with other kinds of wheels, too. To merge the car and the wheels, use the Load models into the scene behavior.

The Load models into the scene behavior

Figure 12. The Load models into the scene behavior

  1. Drag and drop the Load Models into the scene behavior onto the 3D scene. The parameter dialog box in Figure 13 appears.

    The parameter dialog box for the Load models into the scene behavior

    Figure 13. The parameter dialog box for the Load models into the scene behavior

  2. Select the W3D containing the wheels (in my case, alloy_wheel_16_inch_elegance). I can also specify the scale of the models (1.0 by default). This behavior loads all the models present in the specified W3D file, duplicates them in the target W3D scene (the sprite I dropped the behavior onto), and scales them to whatever size I want them to appear.
  3. Press OK.
  4. Press Play in the Director toolbar or press Enter/Return. The movie starts. In the score, the player head holds until the wheels are loaded. When done, they appear in the scene and the player head keeps going until the end of the sprite life span.

    The wheels loaded using the Load models into the scene behavior

    Figure 14. The wheels loaded using the Load models into the scene behavior

Displaying a Video on the Booth Screen

The scene is made up of a booth with the car on a tray. In the background, you can see a screen. Now that the scene is set up, play a video on that screen using the following steps.

  1. Select Insert > Media Element > RealMedia which creates a new RealMedia digital video cast member.
  2. In the Filename field of the Member tab in the Property inspector, enter the URL to a RealMedia video (such as http://myserver.com/video/tvad.rm).
  3. Give a name to the cast member. In this tutorial, I named the digital video formula1video.

  4. The Real Media cast member

    Figure 15. The Real Media cast member

  5. In the score window, create a second instance of the 3D scene by dragging and dropping the main W3D cast member from the internal cast. Now that you have set up the scene, you need a 3D sprite on the same channel with only the behaviors necessary for interactivity or effects.

  6. The Score

    Figure 16. The Score

  7. I also want the player head to hold on a frame during the video playback. To this end, drag and drop the Hold on Current Frame behavior on the score script channel from the standard Navigation library.

    The Play RealVideo behavior

    Figure 18. The Play RealVideo behavior

  8. With the player head on the second sprite , drag and drop the Play Real Video® behavior onto the 3D scene. The parameter dialog box in figure 19 appears.

    The parameter dialog box for the Play Real Video behavior

    Figure 19. The parameter dialog box for the Play Real Video behavior

  9. For the Texture Shader parameter, select the shader (or material) on which the digital video texture will be displayed; for instance, Booth Screen.
  10. For the Real Video Member parameter, select the newly created digital video cast member. For instance, formula1video.
  11. Press Play in the Director toolbar or press Enter/Return. The movie starts, and the video now plays on the booth screen.

    The video playing on the booth screen

    Figure 20. The video playing on the booth screen

    In the Behavior pane of the Property inspector, notice that there is only one entry: the one for the Play Real Video® behavior in Figure 21.

    The Property inspector with the Play Real Video® behavior applied to the booth screen

    Figure 21. The Property inspector with the Play Real Video® behavior applied to the booth screen

    And Figure 22 shows the resulting internal cast.

    The final internal cast

    Figure 22. The final internal cast

In conclusion, the Chrome Library set of 3D behaviors takes the drudgery out of setting up your 3D scenes. Additionally, with a minimum effort on your part, you can create complex interactive scenes (cameras, triggers...), special effects (tweening, particles...), and much more...


About the author

Karl Sigiscar has been a multimedia and web developer since 1997. He developed edutainment CD-Roms with Director as well as dynamic websites. In late 2000, Karl joined the Director 8.5 beta program. Since then, he has delved deeper into the many possibilities of Shockwave 3D (bipeds, havok physics, particles, LOD). In 2002, Karl developed the Shockwave 3D architecture of the game Mogi Mogi for NewtGames as well as new ideas with a focus on 3D interactive model visualization, which are highly interactive (and responsive) product presentations, such as the Audi A8 in 3D with Gedas France. He designed the Chrome Lib set of 3D behaviors first to help graphic artists test their scenes by themselves in Director, then as a personal project with a focus on tweening FX. Karl thinks he has tweened everything possible: the color, the transparency, the fog color, the fog distance, the field of view and so on…

Now Karl works at R3D, a software engineering company, as an ActionSctipt/Java developer.